Skip to content

Integrate context/name schema into program context - #179

Merged
gnidan merged 4 commits into
mainfrom
architect-integrate-context-name
Mar 9, 2026
Merged

Integrate context/name schema into program context#179
gnidan merged 4 commits into
mainfrom
architect-integrate-context-name

Conversation

@gnidan

@gnidan gnidan commented Mar 9, 2026

Copy link
Copy Markdown
Member

The context/name.schema.yaml file has existed since the initial program schema commit but was never wired into program/context.schema.yaml. This PR integrates it using the same if/then pattern as the other context properties (code, variables, remark, pick, gather, frame).

Changes:

  • context.schema.yaml: Add if: required: ["name"] / then: $ref context/name clause to allOf, making name an optional property on any context object.
  • context/name.schema.yaml: Rewrite description to clarify its role — labeling contexts for identification, particularly for disambiguating pick alternatives at runtime.
  • context/pick.schema.yaml: Add a second example showing named alternatives inside a pick.

This is purely additive and non-breaking. The name property becomes available on any context but remains optional. No TypeScript changes needed — the schema validation tests pass with the new examples.

Wire the existing but unreferenced context/name.schema.yaml into
program/context.schema.yaml using the same if/then pattern as
other context properties. Update the name schema description to
clarify its role in disambiguating pick alternatives. Add a named
pick example to demonstrate the intended usage.
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-03-09 20:40 UTC

@gnidan gnidan left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writer review — descriptions and example quality:

context/name.schema.yaml description: The rewrite is a clear improvement. "A label for this context" is better than "The name of the context", and the pick tie-in gives concrete motivation. The "opaque strings" paragraph is a good addition. One small suggestion: "identifying it from other contexts" reads slightly awkwardly — consider "distinguishing it from other contexts" instead.

context.schema.yaml if/then clause: The inline description says "A label for this context, for use in identifying it from other contexts" — this duplicates the first sentence of the name schema's own description almost verbatim. The other if/then descriptions in this file are shorter and describe the role of the property rather than restating the subschema description. Consider something briefer like:

description: |
  An optional label for disambiguating this context from others.

This matches the style of the neighboring entries ("The context's corresponding source code range", "Variable definitions, types, allocations known to exist in the context", etc.).

pick example: Good addition — the name properties make the disambiguation use case concrete. The # example: comment follows conventions. The example pairs well with the existing unnamed pick example, showing the before/after pattern. Looks good.

name example: Adding "inlined-call" is a nice complement to the existing "Array<T=bytes32>" — shows both a simple label and a more complex parameterized name. Consider adding # example: comments to both:

examples:
  # example: simple label for an inlined call site
  - name: "inlined-call"
  # example: parameterized name for a generic instantiation
  - name: "Array<T=bytes32>"

Overall the descriptions are clear and the examples effectively illustrate the use case. The suggestions above are minor polish.

@gnidan gnidan left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs infrastructure review:

Schema index gap: schema:ethdebug/format/program/context/name is not in packages/web/src/schemas.ts. The programSchemaIndex lists ["code", "variables", "remark", "pick", "gather", "frame"] but not "name". This means:

  • When the context schema viewer encounters the $ref to context/name, it will render the schema inline instead of showing a "See documentation" link
  • This is functional but inconsistent with how the other context sub-schemas appear

No spec page exists: There's no packages/web/spec/program/context/name.mdx file. All other context types (code.mdx, variables.mdx, remark.mdx, pick.mdx, gather.mdx, frame.mdx) have dedicated spec pages. Without one, even adding name to the schema index would produce a broken link.

Recommendation: This PR is fine as-is for the schema changes — the SchemaViewer will render context/name inline and the examples will display correctly. But for completeness, a follow-up should:

  1. Add spec/program/context/name.mdx (matching the pattern of sibling files)
  2. Add "name" to the array in schemas.ts line 227

Not blocking — the site will build and work correctly without these. The inline rendering is adequate for now.

gnidan added 3 commits March 9, 2026 16:25
- Use "distinguishing" instead of "identifying it from"
- Shorten inline description in context.schema.yaml to match
  sibling entries' style
- Add example comments to name.schema.yaml examples
Add name.mdx doc page following the pattern of sibling context
pages (remark, frame, etc.). Register the schema ID in schemas.ts
so the spec site links to the new page.
@gnidan
gnidan merged commit 646e61e into main Mar 9, 2026
4 checks passed
@gnidan
gnidan deleted the architect-integrate-context-name branch March 9, 2026 20:35
@gnidan

gnidan commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

Note: the spec page and schemas.ts entry were added to this PR per maintainer decision. Inline schema rendering (without a dedicated spec page) is not acceptable — all new schemas must include their spec page in the same PR, not as a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant